//base
import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
//less
import './index.less'
import If from '../../../../components/page-components/if'

class TitleShowClear extends Component {
  componentWillMount() {
    //onLoad
  }

  componentDidMount() {
    //onready
  }

  componentDidShow() {
    //onshow
  }

  componentDidHide() {
    //onhide
  }

  componentWillUnmount() {
    //onUnload
  }

  delay(time = 0) {
    return new Promise(resolve => {
      setTimeout(() => {
        resolve()
      }, time)
    })
  }

  onExtraTap = () => {
    this.props.onExtraTap()
  }

  render() {
    const { extra, extraName, number, name } = this.props
    return (
      <View className="TitleShowClear_id92051">
        <View className="content">
          <View className="name">{name}</View>
          <View className="number">{number || '0'}</View>
        </View>
        <If visible={extra == 'clear'}>
          <View className="clear-box" onClick={this.onExtraTap}>
            {extraName || '清空'}
          </View>
        </If>
      </View>
    )
  }
}

export default TitleShowClear
